package net.cyue.nest.nestjava.common.data;

import java.util.List;

public class MetaType {
  protected final Class<?> clz;
  protected final List<MetaType> dependencies;

  public MetaType(Class<?> clz) {
    this(clz, null);
  }
  public MetaType(Class<?> clz, List<MetaType> dependencies) {
    this.clz = clz;
    this.dependencies = dependencies;
  }
  public Class<?> getClz() {
    return this.clz;
  }
  public String name() {
    return this.clz.getName();
  }
  public String getName() {
    return this.clz.getName();
  }
  public List<MetaType> dependencies() {
    return this.dependencies;
  }
  public List<MetaType> getDependencies() {
    return this.dependencies;
  }

  public String getTypeName() {
    return this.clz.getTypeName();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) return false;
    return obj.hashCode() == this.hashCode();
  }
  @Override
  public int hashCode() {
    if (this.clz == null) {
      throw new NullPointerException("clz is null");
    }
    return this.getTypeName().hashCode();
  }
}

